import request from '@/utils/request'

// 放款管理模块接口
export const lendingApi = {
  // 3.1 获取放款列表
  getList(params) {
    return request({
      url: '/lending/list',
      method: 'get',
      params
    })
  },
  
  // 3.2 获取放款详情
  getDetail(disbursementId) {
    return request({
      url: `/lending/detail/${disbursementId}`,
      method: 'get'
    })
  },
  
  // 3.3 导出放款列表
  exportList(params) {
    return request({
      url: '/lending/export',
      method: 'get',
      params,
      responseType: 'blob' // 文件流需要设置responseType为blob
    })
  },
  
  // 4.1 获取待放款列表
  getPendingList(params) {
    return request({
      url: '/lending/pending',
      method: 'get',
      params
    })
  },
  
  // 4.2 提交放款申请
  apply(data) {
    return request({
      url: '/lending/apply',
      method: 'post',
      data
    })
  },
  
  // 4.3 放款处理
  process(data) {
    return request({
      url: '/lending/process',
      method: 'put',
      data
    })
  },
  
  // 4.4 获取客户账户信息
  getCustomerAccounts(customerId) {
    return request({
      url: `/lending/account/${customerId}`,
      method: 'get'
    })
  },
  
  // 4.5 新增客户账户信息
  addCustomerAccount(data) {
    return request({
      url: '/lending/account',
      method: 'post',
      data
    })
  },
  
  // 5.1 获取待审批放款列表
  getPendingApprovalList(params) {
    return request({
      url: '/lending/approval/pending',
      method: 'get',
      params
    })
  },
  
  // 5.2 审批放款申请
  submitApproval(data) {
    return request({
      url: '/lending/approval',
      method: 'post',
      data
    })
  },
  
  // 5.3 获取审批历史
  getApprovalHistory(disbursementId) {
    return request({
      url: `/lending/approval/history/${disbursementId}`,
      method: 'get'
    })
  }
} 